from typing import Any, Dict, Optional, List


def test(name, age, sex):
    """位置参数"""
    print("位置参数:", "name=", name, "age=", age, "sex=", sex)


def test_variable(name, age, *args: Any):
    """可变参数"""
    print("可变参数：", "name=", name, "age=", age, "args=", args)


def test_keyword(name, age, **kwargs: Any):
    """关键字参数"""
    print("关键字参数：", "name=", name, "age=", age, "kwargs=", kwargs)


def test_func1(
        name,
        age: int = 25,
        *args: Any,
        **kwargs: Any):
    print("test_func1:", "name=", name, "age", age, "args=", args, "kwargs=", kwargs)


def test_func2(
        *args: Any,
        name: str = None,
        **kwargs: Any):
    print("test_func2:", "args=", args, "name=", name, "kwargs=", kwargs)


def test_func3(
        *args: Any,
        name: str = None,
        tags: Optional[List[str]] = None,
        metadata: Optional[Dict[str, Any]] = None,
        **kwargs: Any, ):
    print("test_func3:", "args=", args, "name=", name, "tags=", tags, "metadata=", metadata, "kwargs=", kwargs)


if __name__ == '__main__':
    test("张三", 25, "男")
    test(name="张三", age=25, sex="男")

    test_variable("张三", 25, "男")

    test_keyword("张三", 25, sex="男", job="工程师")
    test_keyword(name="张三", age=25, sex="男", job="工程师")
    user_dict = {"sex": "男", "job": "工程师"}
    test_keyword(name="张三", age=25, **user_dict)

    test_func1("张三", 25, "广东", sex="男", job="工程师")
    test_func2(age=25, name="张三", sex="男", job="工程师")

    docs = []
    new_inputs = {"question": "中国有几个省份", "chat_history": "chat_history"}
    test_func3(input_documents=docs, name="张三", **new_inputs)
